package cn.qin.dao;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

import cn.qin.model.SPgoods;

public class marketDao {
	private static SessionFactory  sf;
	public void addSp(SPgoods goods){
		sf = new AnnotationConfiguration().configure().buildSessionFactory();
		System.out.println("add");
		goods.setSPcategory(goods.getSPcategory());
		goods.setSPexp(goods.getSPexp());
		goods.setSPid(goods.getSPid());
		goods.setSPimgs(goods.getSPimgs());
		goods.setSPinfo(goods.getSPinfo());
		goods.setSPmarket(goods.getSPmarket());
		goods.setSPmfrs(goods.getSPmfrs());
		goods.setSPpdate(goods.getSPpdate());
		goods.setSPqty(goods.getSPqty());
		goods.setSPspecs(goods.getSPspecs());
		Session session = sf.getCurrentSession();
		session.beginTransaction();
		session.save(goods);
		session.getTransaction().commit();
		sf.close();	
		
		
	}

}
